/** 寄生组合继承： 在子类构造函数内调用父类构造函数，解决了引用属性共享问题；
 *  用 Object.create 创建父类原型的副本作为子类原型，使得子类也拥有原型方法，避免调用父构造函数两次；
 */

function Parent(name) {
    this.name = name;
    this.say = () => {
        console.log(111);
    };
}

Parent.prototype.play = () => {
    console.log(222);
}

function Children(name, age) {
    Parent.call(this, name);
    this.age = age;
}

Children.prototype = Object.create(Parent.prototype);
Children.prototype.constructor = Children;

let c = new Children('Tom', 18);
console.log(c.constructor === Children);
console.log(c.play())
